<template>
 <div id="suggestion">
   <h2>有问题咨询我们？</h2>

   任何技术问题或改善意见，都欢迎在下表空白处输入并提交。我们会及时与您联系，感谢关注！
   <br>
     <el-form :model="ruleForm"  ref="ruleForm" label-width="100px" class="demo-ruleForm">
       <el-form-item  >
         <el-input  v-model="ruleForm.name" autocomplete="off" placeholder="Name/姓名"></el-input>
       </el-form-item>
       <el-form-item  >
         <el-input  v-model="ruleForm.company" autocomplete="off" placeholder="Company/公司"></el-input>
       </el-form-item>
       <el-form-item  >
         <el-input v-model="ruleForm.contact" placeholder="Phone/联系方式"></el-input>
       </el-form-item>
       <el-form-item>
         <el-button style="background-color: #475669" type="primary" @click="submitForm()">提交</el-button>
       </el-form-item>
     </el-form>
     <el-input class="demo-input"
       type="textarea"
       :rows="7"
       placeholder="ContactUs/咨询内容"
       v-model="ruleForm.textarea">
     </el-input>
 </div>





</template>

<script>
  import {requestPost} from "../../../../networks/request";
  export default {
    name: 'suggestion',
    data() {
      return {
        ruleForm: {
          name: '',
          company: '',
          contact: '',
          textarea: '',
        },
      }
    },
    methods: {
      submitForm() {
          if (this.ruleForm.name!=''&&this.ruleForm.company!=''&&this.ruleForm.contact!=''&&this.ruleForm.textarea!='') {
            requestPost({
              url: "suggestion/insert",
              data: {
                name: this.ruleForm.name,
                company: this.ruleForm.company,
                contact: this.ruleForm.contact,
                textarea: this.ruleForm.textarea
            }
          });
            alert("提交成功")
            this.$router.replace("/main")
          } else {
            alert("提交失败,请填写所有信息")
            return false;
          }
      }
    }
  }
</script>

<style scoped>
  #suggestion{
    color: #f6f6f6;
    /*background-color: #4c4c4c;*/
    margin: 0 auto;
    text-align: center;
    width: 810px;
    height: 350px;
    padding-top: 20px;
  }
  .demo-ruleForm{

    margin-top: 30px;
    width: 400px;
    /*padding-right: 20px;*/
    /*height: 500px;*/
    float: left;

  }
  .demo-input{
    margin-top: 30px;
    width: 400px;

  }
</style>



